/*
 * @Descripttion: GGB
 * @version: 1.0
 * @Author: GGB
 * @Date: 2022-02-02 21:23:11
 * @LastEditors: GGB
 * @LastEditTime: 2022-02-05 08:04:19
 */
import axios from "axios"
const request = axios.create({
    baseURL: 'http://api.cpengx.cn/metashop/api'
})

request.interceptors.response.use(response => {
    if (response.status === 200) {
        return response.data
    } else {
        return response
    }
}, error => {
    return Promise.reject(error)
})
/**
 * 获取首页数据
 * @param {*} params 
 * @returns 
 */
export const getHomePage = (params) => request({
    method: "GET",
    url: '/homepage',
    params
})
/**
 * 获取商品列表
 * @param {*} params 
 * @returns 
 */
export const getProducts = (params) => request({
    method: "GET",
    url: '/products',
    params
})